<section>
	<div class="page-header">
		<h2><?php echo $title; ?></h2>
	</div>
	
	<?php echo form_open('', array('autocomplete' => 'off')); ?>
		<div class="clearfix">
			<label>Question <span class="req">*</span></label>
			<div class="input">
				<input type="text" name="question" class="span8" />
			</div>
		</div>
		<div class="clearfix">
			<label>Website <span class="req">*</span></label>
			<div class="input">
				<?php echo show_array_dropdown($websites, 'site_code', 'site_name', '', 'website'); ?>
			</div>
		</div>
		<div id="answers" class="clearfix">
			<label>Answers <span class="req">*</span></label>
			<div class="input">
				<span id="addAnswer" class="btn">Add Answer Field</span>
			</div>
		</div>
		<div class="clearfix">
			<label>Actions</label>
			<div class="input">
				<ul class="inputs-list">
					<li>
						<label>
							<input type="checkbox" name="published" value="y" />
							<span>Published</span>
						</label>
					</li>
				</ul>
			</div>
		</div>
		<div class="actions">
			<button type="submit" class="btn primary">Save</button>
			<?php echo anchor('contents/polls', 'Cancel', array('class' => 'btn')); ?>
		</div>
	</form>
</section>

<script>
	$(function() {
		$('#addAnswer').click().click().click();
	})
	
	$('#addAnswer').click(function() {
		var prnt = $(this).parent();
		var div = $('<div />').addClass('input');
		
		$('<input type="text" name="answer[]" class="span6" />').appendTo(div);
		$('<span class="btn removeAnswer" style="margin-left: 5px">Remove</span>').appendTo(div);
		
		div.insertBefore(prnt);
	});
	
	$('.removeAnswer').live('click', function() {
		$(this).parent().remove();
	});
</script>